package com.twu.biblioteca.DAO;

import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion;
import com.twu.biblioteca.model.User;
import org.mockito.stubbing.OngoingStubbing;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by akutschm on 06/05/2014.
 */
public class UserDAO {

    List<User> users;

    public UserDAO() {
        users = new ArrayList<>();
        users.add(new User("123-4567", "1234", "John Zorn", "xxxx@xxxx.com", "+44 123 45678"));
        users.add(new User("333-4444", "4321", "Thomas Mueller", "xxxx@xxxx.de", "+49 123 45678"));
    }

    public User find(String login, String password) {
        for (User user: users) {
            if (user.getLogin().equals(login) && user.getPassword().equals(password)) {
                return user;
            }
        }
        return null;
    }
}
